<template>
  <div class="myFooter-wrap" v-show="showFooter">
    <div class="myFooter">
      <div class="footer-title">{{$store.state.webInfo.footer}}</div>
      <div class="busuanzi">
        <span id="busuanzi_container_site_pv" style="display:none">
          小破站总访问量
          <span id="busuanzi_value_site_pv"></span>次
          <span class="post-meta-divider">|</span>
        </span>
          <span id="busuanzi_container_site_uv" style="display:none">
          小破站访客数
          <span id="busuanzi_value_site_uv"></span>人
        </span>
      </div>
      <div class="icp">本网站由 <a href="https://gitee.com/cqj1358397900" target="_blank">gitee 小狐狸</a> 强力支持</div>
    </div>
  </div>
</template>

<script>
  let script;
  export default {
    props: {
      showFooter: {
        type: Boolean,
        default: true
      }
    },
    data() {
      return {}
    },
    created() {
      script = require("busuanzi.pure.js");
    },
    mounted() {
      script = require("busuanzi.pure.js");
      script.fetch();
    },
    // 监听,当路由发生变化的时候执行
    watch: {
      $route(to, from) {
        if (to.path !== from.path) {
          script.fetch();
        }
      }
    }
  }
</script>

<style scoped>
  .myFooter-wrap {
    user-select: none;
    animation: hideToShow 2s;
  }

  .myFooter {
    border-radius: 1.5rem 1.5rem 0 0;
    background: var(--gradientBG);
    text-align: center;
    color: var(--white);
    background-size: 300% 300%;
    animation: gradientBG 10s ease infinite;
  }

  .footer-title {
    padding-top: 10px;
    font-size: 16px;
  }

  .icp, .icp a {
    color: var(--maxGreyFont);
    font-size: 13px;
  }

  .icp {
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .icp a {
    text-decoration: none;
    transition: all 0.3s;
  }

  .icp a:hover {
    color: var(--themeBackground);
  }

</style>
